<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>淘贝商城 - 首页</title>
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.4.1/css/bootstrap.min.css">
    <style>
        .navbar-default {
            background-color: #FFA500; /* 橙黄色 */
            border-color: #E69500;
        }
        .navbar-default .navbar-brand,
        .navbar-default .navbar-nav > li > a {
            color: #FFF; /* 白色文字 */
        }
        .navbar-default .navbar-nav > .active > a,
        .navbar-default .navbar-nav > .active > a:hover,
        .navbar-default .navbar-nav > .active > a:focus {
            background-color: #E69500; /* 深一点的橙黄色 */
        }
    </style>
</head>
<body>
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="#">淘贝商城</a>
            </div>
            <ul class="nav navbar-nav">
                <li class="active"><a href="index.html">首页</a></li>
                <li><a href="zw/login.html">登录</a></li>
                <li><a href="zw/register.html">注册</a></li>
                <li><a href="wy/cart.html">购物车</a></li>
                <li><a href="zty/categories.html">商品分类</a></li>
                <li><a href="wy/favorites.html">收藏夹</a></li>
                <li><a href="ljn/profile.html">个人中心</a></li>
            </ul>
        </div>
    </nav>

    <div class="container">
        <h1>欢迎来到淘贝商城</h1>
        <div class="row">
                    <div class="col-md-4">
                        <div class="thumbnail">
                            <img src=D:\taobei-prj\taobei-dev\imgs\2.png alt="手工米面">
                            <div class="caption">
                                <h3>手工米面</h3>
                                <p>无添加农家纯手工米面易煮不糊安徽特产面条鸡汤米面粮油庐江台州</p>
                                <p>价格:70</p>
                                <p>
                                    <button class="btn btn-default add-to-cart" data-name="手工米面" data-price="70" data-image=D:\taobei-prj\taobei-dev\imgs\2.png>加入购物车</button>
                                    <button class="btn btn-default add-to-favorites" data-name="手工米面" data-price="70" data-image=D:\taobei-prj\taobei-dev\imgs\2.png>收藏</button>
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="thumbnail">
                            <img src=D:\taobei-prj\taobei-dev\imgs\1.png alt="小麦胚芽">
                            <div class="caption">
                                <h3>小麦胚芽</h3>
                                <p>小麦胚芽无添加蔗糖未提胚芽油富硒食品正宗纯麦芽熟胚芽粉即食</p>
                                <p>价格：55</p>
                                <p>
                                    <button class="btn btn-default add-to-cart" data-name="小麦胚芽" data-price="55" data-image=D:\taobei-prj\taobei-dev\imgs\1.png>加入购物车</button>
                                    <button class="btn btn-default add-to-favorites" data-name="小麦胚芽" data-price="55" data-image=D:\taobei-prj\taobei-dev\imgs\1.png>收藏</button>
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="thumbnail">
                            <img src=D:\taobei-prj\taobei-dev\imgs\3.png alt="杂粮">
                            <div class="caption">
                                <h3>杂粮</h3>
                                <p>派里奥玻利维亚原料进口三色藜麦米蒸煮营养代餐谷物杂粮米500g</p>
                                <p>价格：77</p>
                                <p>
                                    <button class="btn btn-default add-to-cart" data-name="杂粮" data-price="77" data-image=D:\taobei-prj\taobei-dev\imgs\3.png>加入购物车</button>
                                    <button class="btn btn-default add-to-favorites" data-name="杂粮" data-price="77" data-image=D:\taobei-prj\taobei-dev\imgs\3.png>收藏</button>
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="thumbnail">
                            <img src=D:\taobei-prj\taobei-dev\imgs\4.png alt="挂件">
                            <div class="caption">
                                <h3>挂件</h3>
                                <p>儿童小玩具创意奖品哪吒挂件开学礼物送小朋友分享小学生实用奖励</p>
                                <p>价格：15.9</p>
                                <p>
                                    <button class="btn btn-default add-to-cart" data-name="挂件" data-price="15.9" data-image=D:\taobei-prj\taobei-dev\imgs\4.png>加入购物车</button>
                                    <button class="btn btn-default add-to-favorites" data-name="挂件" data-price="15,9" data-image=D:\taobei-prj\taobei-dev\imgs\4.png>收藏</button>
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="thumbnail">
                            <img src=D:\taobei-prj\taobei-dev\imgs\5.png alt="露肩上衣">
                            <div class="caption">
                                <h3>露肩上衣</h3>
                                <p>黄色一字领短袖T恤女夏季2025新款纯欲风甜辣妹紧身短款露肩上衣</p>
                                <p>价格：99</p>
                                <p>
                                    <button class="btn btn-default add-to-cart" data-name="露肩上衣" data-price="99" data-image=D:\taobei-prj\taobei-dev\imgs\5.png>加入购物车</button>
                                    <button class="btn btn-default add-to-favorites" data-name="露肩上衣" data-price="99" data-image=D:\taobei-prj\taobei-dev\imgs\5.png>收藏</button>
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="thumbnail">
                            <img src=D:\taobei-prj\taobei-dev\imgs\6.png alt="鞋子">
                            <div class="caption">
                                <h3>鞋子</h3>
                                <p>【真皮牛皮】男鞋春秋季2024新款休闲运动鞋男士厚底工装百搭板鞋</p>
                                <p>价格：150</p>
                                <p>
                                    <button class="btn btn-default add-to-cart" data-name="鞋子" data-price="150" data-image=D:\taobei-prj\taobei-dev\imgs\6.png>加入购物车</button>
                                    <button class="btn btn-default add-to-favorites" data-name="鞋子" data-price="150" data-image=D:\taobei-prj\taobei-dev\imgs\6.png>收藏</button>
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="thumbnail">
                            <img src=D:\taobei-prj\taobei-dev\imgs\7.png alt="遮瑕刷">
                            <div class="caption">
                                <h3>遮瑕刷</h3>
                                <p>蘑菇头海绵遮瑕刷遮黑眼圈遮痘印海绵刷便携小馒头遮瑕刷小号迷你</p>
                                <p>价格：30</p>
                                <p>
                                    <button class="btn btn-default add-to-cart" data-name="遮瑕刷" data-price="30" data-image=D:\taobei-prj\taobei-dev\imgs\7.png>加入购物车</button>
                                    <button class="btn btn-default add-to-favorites" data-name="遮瑕刷" data-price="30" data-image=D:\taobei-prj\taobei-dev\imgs\7.png>收藏</button>
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="thumbnail">
                            <img src=D:\taobei-prj\taobei-dev\imgs\8.png alt="山姆会员卡">
                            <div class="caption">
                                <h3>山姆会员卡</h3>
                                <p>山姆会员超市 山姆会员体验卡 山姆会员一日卡 山姆会员一次卡</p>
                                <p>价格：5</p>
                                <p>
                                    <button class="btn btn-default add-to-cart" data-name="山姆会员卡" data-price="5" data-image=D:\taobei-prj\taobei-dev\imgs\8.png>加入购物车</button>
                                    <button class="btn btn-default add-to-favorites" data-name="山姆会员卡" data-price="5" data-image=D:\taobei-prj\taobei-dev\imgs\8.png>收藏</button>
                                </p>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="thumbnail">
                            <img src=D:\taobei-prj\taobei-dev\imgs\9.png alt="键盘">
                            <div class="caption">
                                <h3>键盘</h3>
                                <p>ROG耀光2幻机械键盘有线游戏键盘客制化键盘NX山楂红</p>
                                <p>价格：1299</p>
                                <p>
                                    <button class="btn btn-default add-to-cart" data-name="键盘" data-price="1299" data-image=D:\taobei-prj\taobei-dev\imgs\9.png>加入购物车</button>
                                    <button class="btn btn-default add-to-favorites" data-name="键盘" data-price="1299" data-image=D:\taobei-prj\taobei-dev\imgs\9.png>收藏</button>
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
    <script>
        // 加入购物车功能
        document.addEventListener('DOMContentLoaded', function () {
            const addToCartButtons = document.querySelectorAll('.add-to-cart');
            addToCartButtons.forEach(button => {
                button.addEventListener('click', function () {
                    const product = {
                        name: button.getAttribute('data-name'),
                        price: button.getAttribute('data-price'),
                        image: button.getAttribute('data-image')
                    };
                    addToCart(product);
                });
            });

            // 收藏功能
            const addToFavoritesButtons = document.querySelectorAll('.add-to-favorites');
            addToFavoritesButtons.forEach(button => {
                button.addEventListener('click', function () {
                    const product = {
                        name: button.getAttribute('data-name'),
                        price: button.getAttribute('data-price'),
                        image: button.getAttribute('data-image')
                    };
                    addToFavorites(product);
                });
            });

            function addToCart(product) {
                let cart = JSON.parse(localStorage.getItem('cart')) || [];
                cart.push(product);
                localStorage.setItem('cart', JSON.stringify(cart));
                alert('商品已加入购物车！');
            }

            function addToFavorites(product) {
                let favorites = JSON.parse(localStorage.getItem('favorites')) || [];
                favorites.push(product);
                localStorage.setItem('favorites', JSON.stringify(favorites));
                alert('商品已收藏！');
            }
        });
    </script>
</body>
</html>